<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script>
    window.targetScaleFactor = 2;
</script>
<script src="../resources/srcset-helper.js"></script>
<script src="http://127.0.0.1:8000/resources/slow-script.pl?delay=100"></script>
</head>
<body>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();
    shouldBeTrue("internals.isPreloaded('resources/image2.png');");
    for (var i = 1; i <= 9; ++i) {
        shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?" + i + "');");
        shouldBeFalse("internals.isPreloaded('resources/base-image1.png?" + i + "');");
        shouldBeTrue("internals.isPreloaded('resources/base-image2.png?" + i + "');");
        shouldBeFalse("internals.isPreloaded('resources/base-image3.png?" + i + "');");
    }
    shouldBeFalse("internals.isPreloaded('resources/dup-image1.png?7');");
    shouldBeFalse("internals.isPreloaded('resources/dup-image1.png?8');");
    shouldBeFalse("internals.isPreloaded('resources/dup-image2.png?8');");
    shouldBeFalse("internals.isPreloaded('resources/dup-image3.png?8');");
    shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?10');");
    shouldBeTrue("internals.isPreloaded('resources/base-image1.png?10');");
    shouldBeFalse("internals.isPreloaded('resources/base-image2.png?10');");
    shouldBeFalse("internals.isPreloaded('resources/base-image3.png?11');");
    shouldBeFalse("internals.isPreloaded('resources/preload-test.jpg?11');");
    shouldBeFalse("internals.isPreloaded('resources/base-image1.png?11');");
    shouldBeTrue("internals.isPreloaded('resources/base-image2.png?11');");

</script>
<!-- Control group -->
<link rel="preload" as="image" href="resources/image2.png">
<!-- All permutations of href, imagesrcset and imagesizes -->
<link rel="preload" as="image" href="resources/preload-test.jpg?1" imagesizes="400px" imagesrcset="resources/base-image1.png?1 200w, resources/base-image3.png?1 400w, resources/base-image2.png?1 800w">
<link rel="preload" as="image" href="resources/preload-test.jpg?2" imagesrcset="resources/base-image1.png?2 200w, resources/base-image3.png?2 400w, resources/base-image2.png?2 800w" imagesizes="400px">
<link rel="preload" as="image" imagesizes="400px" href="resources/preload-test.jpg?3" imagesrcset="resources/base-image1.png?3 200w, resources/base-image3.png?3 400w, resources/base-image2.png?3 800w">
<link rel="preload" as="image" imagesizes="400px" imagesrcset="resources/base-image1.png?4 200w, resources/base-image3.png?4 400w, resources/base-image2.png?4 800w" href="resources/preload-test.jpg?4">
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?5 200w, resources/base-image3.png?5 400w, resources/base-image2.png?5 800w" href="resources/preload-test.jpg?5" imagesizes="400px">
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?6 200w, resources/base-image3.png?6 400w, resources/base-image2.png?6 800w" imagesizes="400px" href="resources/preload-test.jpg?6">
<!-- Duplicate attributes -->
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?7 200w, resources/base-image3.png?7 400w, resources/base-image2.png?7 800w" imagesizes="400px" href="resources/preload-test.jpg?7"
     href="resources/dup-image1.png?7">
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?8 200w, resources/base-image3.png?8 400w, resources/base-image2.png?8 800w" imagesizes="400px" href="resources/preload-test.jpg?8"
     imagesrcset="resources/dup-image1.png?8 200w, resources/dup-image3.png?8 400w, resources/dup-image2.png?8 800w">
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?9 200w, resources/base-image3.png?9 400w, resources/base-image2.png?9 800w" imagesizes="400px" href="resources/preload-test.jpg?9"
     imagesizes="800px">
<!-- Sizes with 'x' descriptors -->
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?10 2x, resources/base-image3.png?10 4x, resources/base-image2.png?10 8x" imagesizes="400px" href="resources/preload-test.jpg?10">
<!-- fractional sizes -->
<link rel="preload" as="image" imagesrcset="resources/base-image1.png?11 1w, resources/base-image2.png?11 2w" imagesizes="0.9px" href="resources/preload-test.jpg?11">
</body>
</html>
